-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[hdpowerview] Add support for repeaters #12061
[hdpowerview] Add support for repeaters #12061
Conversation
@jlaur unfortunately I don't have any repeaters so I cannot test the new functionality, but I will at least check that existing functionality (normal shades) has not been broken :) |
I would say fortunately. Not needing them is much desired. :-)
Thanks. I have it running in production now, but would like to run it for some more time before marking as ready. Since it's a new thing type everything is quite isolated and existing functionality should not be affected much. But I already found an assumption in |
Fixes openhab#12060 Signed-off-by: Jacob Laursen <[email protected]>
Signed-off-by: Jacob Laursen <[email protected]>
df5b2d9
to
9356c99
Compare
I know, but didn't think it would be a problem since it's not considered a warning, but just two lines of console output? I'll have another look at this and see if I can mock logger somehow. Please don't let it block this PR as it was introduced by #11853 which is already merged. I'll provide a new PR for this issue and link it to #11852 once I have found a solution. |
Perhaps one can set a lower logger level when running JUnit tests (e.g. EDIT: https://logging.apache.org/log4j/log4j-2.4/faq.html#set_logger_level_from_code
Ok with me. |
I'm definitely against the latter. As for log level manipulration, I could imagine setting log level this way could introduce problems with parallel test runs, but not sure. Also it wouldn't be able to test if something was indeed logged. Initially I tried to create some mocks based on
I was able to run it after modifying pom.xml for the binding: Now wondering if mockito-inline could/should be added to: which is referenced from here: @wborn - any opinion/advice here, i.e. if it would be okay to include mockito-inline instead of mockito-core, and if yes, in which POM? Eventually mockito-inline will be abandoned and we'll need to go back to mockito-core when integrated. See: |
IMHO you should certainly not add a mockito dependency to the binding pom.. Perhaps another solution is to have JUnit call an inner class for the test, that does not do any logging, but throws an exception instead; and then let the binding itself call an outer wrapper class that catches that exception and logs the warning. PS notwithstanding the above, I can tell you that the jar for this build has been running on my operative system for 6 hours or so, and seems to be working as it should. (Although, actually I personally find it rather uncanny that when one moves the shades, the OH UI updates to the new position immediately — even though the shades have not actually achieved that position yet..) |
We fully agree on this. It was a Proof-of-Concept, suggestion was to add it to the linked POM:
I'm not sure I understand what you mean by inner/outer classes, do you mean changing
Thanks for giving it a shot!
Hmm, I think you introduced that behavior in #11698? It was slightly changed in #12002 by using the response directly instead of requesting positions again by sending a new request. I'm open for discussing this, it could even easily be reverted/changed/refined. However, please consider:
So with the new approach we introduced, we'll synchronize with the hub immediately. Previously (before your change) it would be synchronized at a random moment after moving the shade, i.e. upon next poll. So if next poll would be one second after moving the shade, it would be updated then. But it could also have to wait up to one minute. |
Oops. I meant to say “inner/outer method”. Sorry for the confusion.
Yes indeed. But it was not my request, and came rather from the guy who opened the issue. As said, I personally find it uncanny … but I can live with it.. |
Signed-off-by: Jacob Laursen <[email protected]>
@andrewfg - I did a new commit, 271d027, today after some suspicious warnings in my logs. I still don't know what caused that, but I'm keeping an eye on it. Have you (ever) seen anything like that? Unfortunately I'm not keeping old logs, so can't check first occurrence. See last section in PR description for details. |
I always stay away from experimental or incubating features because they can break with any upgrade. We've seen incubating mockito/junit functionality break before (openhab/org.openhab.binding.zwave#1689 (comment)). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a repeater so could not test that Thing type; however I can confirm that the original Shade Things are (still) working.
@lolodomo - looking at recent hdpowerview PR review history, would this be something for you to have a look at? :-) |
@openhab/add-ons-maintainers - anyone willing to review this PR? I have some additional work planned for another PR, but need this one merged first. |
You could base your work on this PR's branch and add the "awaiting other PR" label for your new PR. |
Signed-off-by: Jacob Laursen <[email protected]>
Signed-off-by: Jacob Laursen <[email protected]>
True. I'm just not a fan of such dependency chains as there could also be other things merged in the meantime. Or this one might not be merged at all. So when preparing small changes with big risk of conflicts, I tend to prefer waiting. But thanks for the hint! |
No, was unaware - thanks. Now after reading it, I think it will work better with current approach, since state will be kept for the duration of the blinking period. This looks kind of cool in the UI. :-) I don't think it's possible to set a timer using the policies? |
There's no timer for update policies I'm aware of. Your approach is good to go. |
Signed-off-by: Jacob Laursen <[email protected]>
Signed-off-by: Jacob Laursen <[email protected]>
Signed-off-by: Jacob Laursen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Add support for repeaters. Fixes openhab#12060 Signed-off-by: Jacob Laursen <[email protected]> * Simplify thing type filtering. Signed-off-by: Jacob Laursen <[email protected]> * Improve robustness of configuration ID validation/initialization. Signed-off-by: Jacob Laursen <[email protected]> * Convert repeater-identify to command channel. Signed-off-by: Jacob Laursen <[email protected]> * Fix logged warning. Signed-off-by: Jacob Laursen <[email protected]> * Skip unneeded bridge status logic. Signed-off-by: Jacob Laursen <[email protected]> * Skip redundant logging. Signed-off-by: Jacob Laursen <[email protected]> * Fix chanenl type label for blinking enabled. Signed-off-by: Jacob Laursen <[email protected]>
@lolodomo - would it be possible for you to synchronize hdpowerview_da_properties with Crowdin as this was mistakenly included in this PR and a few others? Current situation is that Danish strings already exist in the repository, but they are not available in Crowdin. |
Is it ok to simply override all Crowdin translations by those in Github? |
Yes, at least the Danish ("_da") ones which seems missing in Crowdin. I'm not sure if there are any other translations in Crowdin for hdpowerview not yet in the repository, but probably not? Can't figure out how to see all translations for a single bundle. |
Translations uploaded in Crowdin. Only 29% of translations are completed. |
Thanks! Do we have any guidelines or documentation for the processes involving Crowdin synchronization/workflows? By now I understand that default (English) properties are one-way synced from repository to Crowdin. Then translations are synced back to repository, and it creates some kind of trouble if they are going the other way - perhaps simply because there is no automation for that? But some details would be nice for the understanding. Also what it takes to assess if a Crowin PR is safe to merge. I can help write it if it doesn't exist, but first I would need some more knowledge. :) |
Default (English) properties are one-way automatically synced from repository to Crowdin. |
* Add support for repeaters. Fixes openhab#12060 Signed-off-by: Jacob Laursen <[email protected]> * Simplify thing type filtering. Signed-off-by: Jacob Laursen <[email protected]> * Improve robustness of configuration ID validation/initialization. Signed-off-by: Jacob Laursen <[email protected]> * Convert repeater-identify to command channel. Signed-off-by: Jacob Laursen <[email protected]> * Fix logged warning. Signed-off-by: Jacob Laursen <[email protected]> * Skip unneeded bridge status logic. Signed-off-by: Jacob Laursen <[email protected]> * Skip redundant logging. Signed-off-by: Jacob Laursen <[email protected]> * Fix chanenl type label for blinking enabled. Signed-off-by: Jacob Laursen <[email protected]> Signed-off-by: Nick Waterton <[email protected]>
* Add support for repeaters. Fixes openhab#12060 Signed-off-by: Jacob Laursen <[email protected]> * Simplify thing type filtering. Signed-off-by: Jacob Laursen <[email protected]> * Improve robustness of configuration ID validation/initialization. Signed-off-by: Jacob Laursen <[email protected]> * Convert repeater-identify to command channel. Signed-off-by: Jacob Laursen <[email protected]> * Fix logged warning. Signed-off-by: Jacob Laursen <[email protected]> * Skip unneeded bridge status logic. Signed-off-by: Jacob Laursen <[email protected]> * Skip redundant logging. Signed-off-by: Jacob Laursen <[email protected]> * Fix chanenl type label for blinking enabled. Signed-off-by: Jacob Laursen <[email protected]>
* Add support for repeaters. Fixes openhab#12060 Signed-off-by: Jacob Laursen <[email protected]> * Simplify thing type filtering. Signed-off-by: Jacob Laursen <[email protected]> * Improve robustness of configuration ID validation/initialization. Signed-off-by: Jacob Laursen <[email protected]> * Convert repeater-identify to command channel. Signed-off-by: Jacob Laursen <[email protected]> * Fix logged warning. Signed-off-by: Jacob Laursen <[email protected]> * Skip unneeded bridge status logic. Signed-off-by: Jacob Laursen <[email protected]> * Skip redundant logging. Signed-off-by: Jacob Laursen <[email protected]> * Fix chanenl type label for blinking enabled. Signed-off-by: Jacob Laursen <[email protected]> Signed-off-by: Andras Uhrin <[email protected]>
Fixes #12060
Signed-off-by: Jacob Laursen [email protected]
Add support for Hunter Douglas PowerView Repeaters.
Supporting the Repeater as a thing makes it possible to:
Technical approach
Result
Thing
Channels
Additional refactoring
After testing with frequent binding restarts and configuration changes, I noticed a few warnings on follow-up log inspection:
I have not yet found the root cause, and I do not suspect the changes in this PR to be causing this behavior. But nevertheless I would like to get to the bottom of this, so as first step I simplified the configuration ID handling to be more robust by changing it from string to integer and adding validation. Doing this for the new repeater thing was fully within the scope of this PR, but for consistency I decided to perform the same refactoring for the shade thing. I have tested backwards compatibility for the change by creating a thing with version 3.2 of the binding from UI, then migrated to the PR version and verified that thing still works correctly.